<template>
    <div>
        <mh></mh>

        <main class="" id="main-collapse">
            <!--面包屑导航 通过：进行传参操作-->
            <bread :datas="this.datas"></bread>
            <Form>
                <FormItem label="课程分类">

                    <input type="text" v-model="name">

                </FormItem>
                <FormItem>
                    <Button @click="submit" >提交</Button>
                </FormItem>
            </Form>
            
        </main>
    </div>
</template>

<script>
    import mh from './mh.vue'
    // 导入面包屑导航组件
    import bread from './bread.vue'
    export default {
        data() {
            return {
                name:'',
                //面包屑变量
                datas:[{'title':'首页',route:{name:'index'}},{title:'添加课程分类'}],
            }
        },
        components: {
            'mh':mh,
            //声明标签
            'bread':bread
        },
        methods: {
            submit(){
                this.axios({
                    url:'http://localhost:8000/addCategory/',
                    method:'post',
                    data:{
                        'name':this.name
                    }
                }).then(res=>{
                    if (res.data.code==200) {
                        console.log('ok')
                    }else{
                        console.log('off')
                    }
                })
            }
        },

    }
</script>

<style>

</style>